//
//class sum
//{
//public:
//    sum()
//    {
//        _ret += _i;
//        _i++;
//    }
//
//    static int Getret()
//    {
//        return _ret;
//    }
//
//private:
//    static int _i;
//    static int _ret;
//
//};
//
//int sum::_i = 1;
//int sum::_ret = 0;
//
//
//class Solution {
//public:
//    int Sum_Solution(int n) {
//        sum* p = new sum[n];
//        return sum::Getret();
//    }
//};




#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
using namespace std;


class Date
{
public:
    int Get_day(int year, int month)
    {
        int month_day[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };
        if ((year % 4 == 0 && year / 4 != 0) || year % 400 == 0)
        {
            month_day[2] = 29;
        }
        return month_day[month];
    }

    Date(int year, int month, int day)
        :_year(year)
        , _month(month)
        , _day(day)
    {
    }

    bool operator<(const Date& d)
    {
        if (_year < d._year)
        {
            return true;
        }
        else
        {
            if (_month < d._month)
            {
                return true;
            }
            else
            {
                if (_day < d._day)
                {
                    return true;
                }
            }
        }
        return false;
    }
    bool operator==(const Date& d)
    {
        return _year == d._year
            && _month == d._month
            && _day == d._day;
    }
    bool operator!=(const Date& d)
    {
        return !(*this == d);
    }

    Date& operator-=(int day)
    {
        if (day < 0)
        {
            return *this += (-day);
        }
        _day -= day;
        while (_day <= 0)
        {
            _month--;
            if (_month == 0)
            {
                _year--;
                _month = 12;
            }
            _day += Get_day(_year, _month);
        }
        return *this;

    }

    Date& operator+=(int day)
    {
        if (day < 0)
        {
            return *this -= (-day);
        }
        _day += day;

        _day += day;
        if (_day > Get_day(_year, _month))
        {
            _day -= Get_day(_year, _month);
            _month++;
            if (_month == 13)
            {
                _year++;
                _month = 1;
            }
        }
        return *this;
    }


    Date operator++()
    {
        Date tmp = *this;
        *this += 1;
        return tmp;
    }

    void get_monthday(const Date& d)
    {

        Date max = *this;
        Date min = d;
        if (*this < d)
        {
            max = d;
            min = *this;

        }

        int n = 0;
        while (max != min)
        {
            ++min;
            ++n;
        }
        _day++;
        cout << _day << endl;

    }
private:
    int _year;
    int _month = 0;
    int _day;

};
int main() {
    int year1, year2, month1, month2, day1, day2;
    scanf("%4d%2d%2d", &year1, &month1, &day1);
    scanf("%4d%2d%2d", &year2, &month2, &day2);
    Date d1(year1, month1, day1);
    Date d2(year2, month2, day2);
    d1.get_monthday(d2);


}


#include <iostream>
using namespace std;

int main() {
    int _year, _month, _day;
    int month_day[13] = { 0,31,28,31,30,31,30,31,31,30,31,30,31 };
    cin >> _year >> _month >> _day;
    if ((_year % 4 == 0 && _year % 100 != 0) || (_year % 400 == 0))
    {
        month_day[2] = 29;
    }
    int ret = 0;
    for (int i = 0; i < _month; i++)
    {
        ret += month_day[i];
    }
    ret += _day;
    cout << ret;

}